%
% Vasyl Mykhalchuk
%
function [ isCriticalPoint ] = isFP( iVertex, scalarField, adjacentVertices, kTRESHOLD )
isCriticalPoint = 0;
length = size( adjacentVertices, 2 );

fpValues = zeros( length, 1 );
for i = 1:length
    if ( adjacentVertices( iVertex, i ) ~= 0 )
        fpValues( i ) = abs( scalarField( adjacentVertices( iVertex, i ) ) );
    else %
        i = length + 1;
    end % IF
end % FOR

maxFPVal = max( abs( fpValues ) );

if ( ( abs(scalarField( iVertex ) ) > maxFPVal ) && ( abs(scalarField( iVertex ) ) > kTRESHOLD )  )    
    isCriticalPoint = 1;    
end % IF

end % FUNCTION

